﻿//------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Xml;
using System.Text;

namespace Microsoft.ResourceManagement.Samples.ResourceManagementClient.ExtensionIdentityManagementOperations
{
    [XmlRoot(ElementName = "AddRequest", Namespace = Constants.NamespaceDirectoryAccess)]
    public class AddRequest
    {
        private String dialect;
        private List<DirectoryAccessChange> attributeTypes;

        public AddRequest()
        {
            this.attributeTypes = new List<DirectoryAccessChange>();
            this.dialect = Constants.ExtensionIdentityManagementOperationsDefaultDialect;
        }
        
        [XmlAttribute(AttributeName = "Dialect")]
        public String Dialect
        {
            get
            {
                return this.dialect;
            }
            set
            {
                this.dialect = value;
            }
        }
        
        // List so the serializer can add elements
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly"), XmlElement(ElementName = "AttributeTypeAndValue")]
        public List<DirectoryAccessChange> AttributeTypeAndValues
        {
            get
            {
                return this.attributeTypes;
            }
            set
            {
                this.attributeTypes = value;
            }
        }
    }

    public class AttributeTypeAndValue
    {
        private string attributeType;
        private XmlNode attributeValue;

        public AttributeTypeAndValue()
        {
            this.attributeType = String.Empty;
        }
        
        [XmlElement(ElementName="AttributeType", Namespace=Constants.NamespaceDirectoryAccess)]
        public String AttributeType
        {
            get
            {
                return this.attributeType;
            }
            set
            {
                this.attributeType = value;
            }
        }

        
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes", MessageId = "System.Xml.XmlNode"), XmlElement(ElementName = "AttributeValue", Namespace = Constants.NamespaceDirectoryAccess)]
        public XmlNode AttributeValue
        {
            get
            {
                return this.attributeValue;
            }
            set
            {
                this.attributeValue = value;
            }
        }
    }
}
